<?php

namespace Xrfg\Core\Trading\Account\Models;

use Illuminate\Database\Eloquent\Model;
use Xrfg\Core\User\Models\User;

/**
 * Xrfg\Core\Trading\Account\Models\Account.
 *
 * @property int                                    $id        账户ID
 * @property int                                    $user_id   用户ID
 * @property int                                    $coin_id   币种ID
 * @property float|null                             $available 可用余额
 * @property float|null                             $disabled  可用余额
 * @property string|null                            $address   充值地址
 * @property string|null                            $tag       地址标签
 * @property \Xrfg\Core\Trading\Account\Models\Coin $coin
 *
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Account newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Account newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Account query()
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Account whereAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Account whereAvailable($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Account whereCoinId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Account whereDisabled($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Account whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Account whereTag($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Account whereUserId($value)
 * @mixin \Eloquent
 */
class Account extends Model
{
    use AccountLogHelper;

    public $timestamps = false;

    protected $table = 'trading_accounts';

    protected $fillable = ['coin_id', 'user_id'];

    public function coin()
    {
        return $this->hasOne(Coin::class, 'id', 'coin_id');
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
